use "actions T1 - T6.dta" ,clear

*** Group Coordination

gen A=OwnAction==1
gen B=OwnAction==2
gen C=OwnAction==3

tab OwnAction treatment, column



sort session MatchingGroup NetworkGroup
egen netgroup=group(session MatchingGroup NetworkGroup)

sort netgroup Period
by netgroup Period: gen index=_n==1
by netgroup Period: egen Coord_C=total(C)
by netgroup Period: egen Coord_B=total(B)
by netgroup Period: egen Coord_A=total(A)


gen C_A=Coord_A==8
gen C_B=Coord_B==8
gen C_C=Coord_C==8


gen Coord=C_A+C_B+C_C

 tab treatment Coord, row

 
tab treatment if index==1, sum(Coord) nostandard nofreq
tab treatment if index==1, sum(C_A) nostandard nofreq
tab treatment if index==1, sum(C_B) nostandard nofreq
tab treatment if index==1, sum(C_C) nostandard

****Pair Coordination

gen paircoordination=OwnAction==OtherAction
gen paircoordinationA=0 
replace paircoordinationA=1 if paircoordination==1&OwnAction==1
gen paircoordinationB=0 
replace paircoordinationB=1 if paircoordination==1&OwnAction==2
gen paircoordinationC=0 
replace paircoordinationC=1 if paircoordination==1&OwnAction==3

sort treatment
by treatment: sum paircoordination
by treatment: sum paircoordinationA
by treatment: sum paircoordinationB
by treatment: sum paircoordinationC

